//
//  FeedService.m
//  NewsReader
//
//  Created by blacksun on 11-2-16.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "FeedService.h"


@implementation FeedService


-(void) queryFeedsWithSectionOrSubject:(Section *)aSection{
	NSInteger size = appDelegate.user.feedSizePerRequest;
	
	NSLog(@"%d",aSection.currentMinId);
	NSInteger count = [SqlUtil countFeedsWithSectionId:aSection.sectionId from:aSection.currentMinId-size-1 to:aSection.currentMinId-1];
	if (count == size) {
		NSLog(@"11-%d",count);
		return;
	}
	NSString *urlStr = [URLAddress loadOlderFeedsWithSection:aSection.sectionId currentMinId:aSection.currentMinId-1];
	FeedRequestCallBack *callback = [[FeedRequestCallBack alloc] initWithDelegate:self];
	JsonRequest *request = [[JsonRequest alloc] initWithURLStr:urlStr delegate:callback andCommand:kFeedQueryFeedsWithSectionOrSubject];
	//[self.activeRequest setObject:aSection.sectionId forKey:request];
	[request start];
	[request release];
	[callback release];
}


 
@end
